#include "../../common/detail.hpp"
#include "../../client/rpc_client.hpp"


void callback(const Json::Value &result)
{
    ILOG("callback result: %d", result.asInt());
}

int main()
{
    zl::client::RpcClient client(false, "127.0.0.1", 8080);

    Json::Value params, result;
    params["num1"] = 19;
    params["num2"] = 2;

    bool ret = client.call("Add", params, result);
    if (ret != false)
    {
        ILOG("result: %d", result.asInt());
    }

    zl::client::RpcCaller::JsonAsyncResponce async_rsp;
    params["num1"] = 11;
    params["num2"] = 55;

    bool ret2 = client.call("Add", params, async_rsp);
    if (ret2 != false)
    {
        result = async_rsp.get();
        ILOG("result: %d", result.asInt());
    }

    params["num1"] = 21;
    params["num2"] = 54;

    bool ret3 = client.call("Add", params, callback);
 

    return 0;
}